package fourzerofour.guoshixu.day01;

/**
 * 打印菱形
 */
public class Question13 {
    public static void main(String[] args) {
        //菱形的对角线相等，即最长列和行数相等，假设为n
        int n = 7;
        for(int i=0;i<n;i++){
            for(int j=0;j<n/2+(i+1);j++){
                if(i<n/2){
                    if(j<n/2-i){
                        System.out.print(" ");
                    }else{
                        System.out.print("*");
                    }
                }else{
                    if(j<i-n/2){
                        System.out.print(" ");
                    }else if(j<n-(i-n/2)){
                        System.out.print("*");
                    }
                }
            }
            System.out.println();
        }

    }
}
